function a=computeAConstraint(Hu, cB, constraintsE, constraintsF, constraintsG, powersA, powersAB, lastX, lastU)
gamma = constraintsG(1:end, 1:end-1);

eTerm = [];
fTerm = [];
gTerm = [];

if (~isempty(constraintsE))
    eTerm = constraintsE(1:end, end:end);
end

if (~isempty(constraintsF))
    firstTermConstraintsFancyF = generateConstraintsFancyF(Hu, cB, 1, constraintsF);

    fTerm = -firstTermConstraintsFancyF * lastU - constraintsF(1:end, end:end);
end

if (~isempty(constraintsG))
    gTerm = -gamma * (powersA * lastX + powersAB * lastU) - constraintsG(1:end, end:end);
end

a = [eTerm; fTerm; gTerm];
end